<?php

class myUser extends sfGuardSecurityUser
{
	public static function subscribe($username, $password, $charid)	{
		$user = new sfGuardUser() ;
		$user->setUsername($username) ;
		$user->setPassword($password) ;
		$user->save() ;

		$player = new Player() ;
		$player->setUserId($user->getId()) ;
		$player->setCharId($charid) ;
		$player->setNbLoss(0) ;
		$player->setNbDraw(0) ;
		$player->setNbWin(0) ;
		$player->setNbChallenge(0) ;
		$player->setPoints(sfConfig::get('app_elo_base_points')) ;
		$player->save() ;
	}
}
